import { ca } from "element-plus/es/locale";
import request from "./request";
import { ElMessage } from 'element-plus'
const requestMapping = "/user";

//用户登录
const login = async (data: TYPE.User) => {
 
    const res = await request({
      url:  requestMapping + "/login",
      method: "post",
      data,
    })
   localStorage.setItem("token", res.data.data.token);
   ElMessage.success("登录成功")
  

};
const register = async (data: TYPE.User) => {
    await request({
      url:  requestMapping + "/register",
      method: "post",
      data,
    })
    ElMessage.success("注册成功")
 
}

const test = async () => {
  await request({
     url:  requestMapping + "/test",
     method: "get",
   })
   ElMessage.success("测试成功")
 }
export {
    login,
    register,
    test
}